<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function checks(val) {
            if (val.checked===true){
                document.getElementById("tettt").innerHTML+=document.getElementById(val)+",";
            }
        }
    </script>

</head>
<body >
<input type="text" id="tettt">
<div onchange="checks(this.id)">
    <input type="checkbox" id="a" >a
    <input type="checkbox" id="b">b
    <input type="checkbox" id="c">c
    <input type="checkbox" id="d">d
    <input type="checkbox" id="e">e
    <input type="checkbox" id="f">f
    <input type="checkbox" id="g">g
</div>
</body>
</html>